package com.game.modular.game.battle.panel.skillEffect.domain;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class LayerValue {
    // 同时也是key
    @ApiModelProperty("当前叠数")
    private Integer layerNumber;

    @ApiModelProperty("最新触发叠加的回合数")
    private Integer layerRound;

    @ApiModelProperty("最新刷新本层的回合")
    private Integer refreshRound;

    @ApiModelProperty("本次技能效果生效触发的次数")
    private Integer triggerCount;

    @ApiModelProperty("本次衰弱数值")
    private Double thisDecayValue;
    @ApiModelProperty("累计衰弱数值")
    private Double totalDecayValue;

    @ApiModelProperty("上次触发数值")
    private Double lastChangeValue;
    @ApiModelProperty("最新触发变动数值")
    private Double thisChangeValue;


    @ApiModelProperty("累计触发数值")// 用于恢复数值
    private Double totalChangeValue;

    public void refreshTrigger() {
        triggerCount += 1;
        lastChangeValue = thisChangeValue;
        thisChangeValue = 0.0;
    }


    public void refreshDecayValue(Double decayValue) {
        refreshTrigger();
        thisDecayValue = decayValue;
        totalDecayValue += decayValue;
        thisChangeValue = lastChangeValue - decayValue;
        totalChangeValue += thisChangeValue;
    }


    public String obtainThisChangeInfo() {
        String m = "%d:%d";
        return String.format(m, layerNumber, thisChangeValue);
    }


}
